package com.pwc.conversionTool.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Transient;

import org.codehaus.jackson.annotate.JsonIgnore;

import com.googlecode.objectify.Key;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Ignore;
import com.googlecode.objectify.annotation.Index;

@Entity
public class TaskFlow implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4473392710732699135L;

	@Id
	private Long id;

	private String taskFlowName;
	
	// new, running, complete
	private String status;

	
	
	@Index Key<Account> account;
	
	private Key<Task> firstTaskKey;
	
	private Key<Task> lastTaskKey;
	
	@Index protected Date createdDate;
	
	@Index protected Date complateDate;
	




	@Ignore
	private TaskFlowLog taskFlowLog;





	public TaskFlow() {
		super();
	}

	public TaskFlow(String taskFlowName, String status) {
		super();
		this.taskFlowName = taskFlowName;
		this.status = status;		
		this.createdDate=new Date();
	}
	
	
	
	public TaskFlow(String taskFlowName, String status, Key<Account> account) {
		super();
		this.taskFlowName = taskFlowName;
		this.status = status;
		this.account = account;
		this.createdDate=new Date();
	}

	@JsonIgnore
	public Key<Account> getAccount() {
		return account;
	}

	public void setAccount(Key<Account> account) {
		this.account = account;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getTaskFlowName() {
		return taskFlowName;
	}

	public void setTaskFlowName(String taskFlowName) {
		this.taskFlowName = taskFlowName;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}


	
	@JsonIgnore
	public Key<Task> getFirstTaskKey() {
		return firstTaskKey;
	}

	public void setFirstTaskKey(Key<Task> firstTaskKey) {
		this.firstTaskKey = firstTaskKey;
	}
	

	@JsonIgnore
	public Key<Task> getLastTaskKey() {
		return lastTaskKey;
	}

	public void setLastTaskKey(Key<Task> lastTaskKey) {
		this.lastTaskKey = lastTaskKey;
	}
	

	public TaskFlowLog getTaskFlowLog() {
		return taskFlowLog;
	}

	public void setTaskFlowLog(TaskFlowLog taskFlowLog) {
		this.taskFlowLog = taskFlowLog;
	}
	
	
	
	public Date getCreatedDate() {
		return createdDate;
	}

	public void setCreatedDate(Date createdDate) {
		this.createdDate = createdDate;
	}
	
	public Date getComplateDate() {
		return complateDate;
	}

	public void setComplateDate(Date complateDate) {
		this.complateDate = complateDate;
	}



	@JsonIgnore
	@Transient
	public Key<TaskFlow> getKey() {
		return Key.create(TaskFlow.class, id);
	}




}
